 import {useSearchParams} from 'react-router-dom'
 import {TodoList} from '@/page/test/TodoList'
 import {TodoInput} from '@/page/test/TodoInput'
 import {useState} from 'react'

 export function Goods(){
    const [params] =useSearchParams()
    const id = params.get('id')

    
    const list2 = [
        {id:1,task:'learn js'},
        {id:2,task:'learn html'},
    ]
    const [list,setList] = useState(list2)
    const addTodo = (data)=>{
        console.log(data)
        let arr = [...list,data]
        // list.push(data)
        setList(arr)
    }
    return(
        <div> 
            <TodoInput addTodo={addTodo}></TodoInput>
            <TodoList list={list}></TodoList>
        </div>
    )
 }

 export default Goods